package com.ruoyi.web.controller.app.service;

import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.framework.web.exception.base.XException;
import com.ruoyi.sj.domain.Collect;
import com.ruoyi.sj.mapper.CollectMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Map;

/**
 * @ClassName MyCollectService
 * @Description TODO
 * @Author tyc@yanyu
 * @Date 2018/12/7 0007 16:07
 **/
@Service
public class AppCollectService {
    @Autowired
    private CollectMapper collectMapper;

    /**
     * 收藏（不用）
     * @param map
     * @return
     */
    public Object addCollect(Map<String, String> map) {
        Collect collect = new Collect();
        if (map.get("type")=="1"){
            collect.setURL(map.get("URL"));
        }
        collect.setContent(map.get("content"));//内容
        collect.setMemberId(Long.valueOf(map.get("memberId")));//用户ID
        collect.setMessageId(map.get("messageId")); //信息id
        collect.setTitle(map.get("title")); //主题
        collect.setRemark(map.get("remark")); //备注
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        collect.setCreateDate(simpleDateFormat.format(new Date())); //收藏时间
        collect.setType(Integer.valueOf(map.get("type")));
        return null;
    }
}
